-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix path initialize #2117
Fix path initialize #2117
Conversation
Ok the point is clear. I would it differently anyway, And this was my first thinking. Now while i write, i'm asking myself... Do you have a link to the situation that is creating the bug? |
@asturur Thank you for your reply! You suggest that |
So we do not add anything in initialize. is useless if you think of it, just send the options in _setPositionDimensions, is less code to write, maybe more readable. |
@asturur Absolutely! Thank you for your suggestion! I write a unit test.
This was failed at master build, it would not fail after this PR.
|
It would be the situation for confirming the bug. |
https://jsfiddle.net/mq00xq3y/102/ Ok here is more clear, same Path, same top, just left 0 and left 10 and the path are misplaced. Thank you anyway, nasty hidden bug ( created by me for sure ) |
Thank you for jsfiddle. It is more clear, absolutely! |
@kangax this PR is safe. Long of time ago ( jun 2014 ) i changed path initialize to solve various glitch of svg import and drawing in general. The logic was 'isLeftSet' and 'isTopSet', i changed them with this.top = this.top || calcDim.top ( same logic for left ). |
At #2095, there are two problems inside.
First problem comes from group.toObject would be fixed by #2101.
Second problem comes from path.initialize would be fixed by this PR.
At initialization, option.top = 0, then, path.top is updated by _setPositionDimensions, which makes path.top to nonzero, sometime.
To avoid updating by _setPositionDimensions,
this PR set path.top=null if option.top is undefined.set path.top by option.top is undefined or not.In _setPositionDimensions, judge updating path.top by path.top is null or not.